package cn.iocoder.yudao.module.erp.dal.mysql.priaccount;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.erp.dal.dataobject.priaccount.PriAccountDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.erp.controller.admin.priaccount.vo.*;

/**
 * ERP 一级库台账 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PriAccountMapper extends BaseMapperX<PriAccountDO> {

    default PageResult<PriAccountDO> selectPage(PriAccountPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PriAccountDO>()
                .eqIfPresent(PriAccountDO::getAffairs, reqVO.getAffairs())
                .eqIfPresent(PriAccountDO::getMainId, reqVO.getMainId())
                .eqIfPresent(PriAccountDO::getAffairsId, reqVO.getAffairsId())
                .eqIfPresent(PriAccountDO::getDeptId, reqVO.getDeptId())
                .likeIfPresent(PriAccountDO::getProductName, reqVO.getProductName())
                .eqIfPresent(PriAccountDO::getProductId, reqVO.getProductId())
                .eqIfPresent(PriAccountDO::getProductUnit, reqVO.getProductUnit())
                .eqIfPresent(PriAccountDO::getProductStandards, reqVO.getProductStandards())
                .eqIfPresent(PriAccountDO::getProductPrice, reqVO.getProductPrice())
                .eqIfPresent(PriAccountDO::getProductBatch, reqVO.getProductBatch())
                .betweenIfPresent(PriAccountDO::getProductValidityDate, reqVO.getProductValidityDate())
                .eqIfPresent(PriAccountDO::getCount, reqVO.getCount())
                .eqIfPresent(PriAccountDO::getRemark, reqVO.getRemark())
                .eqIfPresent(PriAccountDO::getStatus, reqVO.getStatus())
                .eqIfPresent(PriAccountDO::getProcessInstanceId, reqVO.getProcessInstanceId())
                .betweenIfPresent(PriAccountDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PriAccountDO::getId));
    }

}